1. Field of the Invention
The field of the invention is data processing, or, more specifically, methods, systems, and products for scheduling threads in a multi-processor computer.
2. Description of Related Art
A thread is a unit of software execution on a multi-processing computer. On such a computer, software programs are executed in units of execution called ‘processes’ that include all the processor registers, code segment and offset registers, data segment and offset registers, stack segment and offset registers, flag registers, instruction pointer registers, program counters, and so on, needed for execution of software programs. For efficiency, ‘processes’ are often organized further as threads, where each thread of a process individually possesses all the attributes needed for execution except that a thread shares memory among all the threads of a process, thereby reducing the overhead of operating system switches from thread to thread (‘context switches’).
Each thread in a multi-processor computer typically is dispatched to run on a processor for a time slice, a predetermined maximum period of time for which the thread may retain possession of the processor. A thread may leave the processor by issuing a system call, for example, to send or receive data to or from input/output functions, at which time the thread is dispatched to a wait queue to wait for a return interrupt representing a response from input/output functions. While a thread is running on a processor, the thread may be interrupted by interrupts representing input/output responses from other threads, threads that are waiting on the wait queue for input/output. The interrupted thread never knows that it has been interrupted. If it is interrupted often, however, there is an effect on its overall performance despite the fact that the thread itself is never aware of its interruptions.
Consider a thread with a time slice of 10 milliseconds that is interrupted 10 times during a single time slice of operation on a processor. Assume that each interrupt requires 5 milliseconds to process. In this example, the thread requires 60 milliseconds of objective time to conduct 10 milliseconds of actual processing. For a processor-bound thread, that is, for a thread that tends to need its entire time slice on the processor, this fact pattern is very inefficient for its overall efficiency of operation.
Prior art solutions included binding interrupt processing exclusively to a single processor or to a subset of the processors on a system and refraining from assigning threads to processors reserved for interrupt processing. Such an approach is relatively static, however, leaving interrupt processing on a subset of processors and thread processing on a subset of processors even when other processors would otherwise be available to spread occasional large loads of thread processing or interrupt processing. Other prior art methods of administering varying load conditions among processors are based on load factors such as queue occupancy and measures of throughput, with little or no attention to dynamic management on the basis of interrupt frequency or interrupt count. There is an ongoing need therefore for improvement in scheduling threads in a multi-processor computer system.